/*
 * @author: sanbao
 * @Date: 2022-08-05 14:31:15
 */
import {
    //创建路由
    createRouter,
    //histy 模式
    createWebHashHistory,
    RouteRecordRaw
} from "vue-router";
import Layout from '../layout/index.vue'

const routes: Array<RouteRecordRaw> = [{
    path: '/',
    name: '_Layout',
    component: Layout,
    redirect: '/profile',
    children: [
        {
            path: '/profile',
            name: '_profile',
            component: () => import('../page/profile/index.vue'),
        },
        {
            path: '/articleCreate',
            name: '_articleCreate',
            component: () => import('../page/articleCreate/index.vue'),
        },
        {
            path: '/articleRanking',
            name: '_articleRanking',
            component: () => import('../page/articleRanking/index.vue'),
        },
        {
            path: '/chart',
            name: '_chart',
            component: () => import('../page/chart/index.vue'),
        },
        {
            path: '/permissionList',
            name: '_permissionList',
            component: () => import('../page/permissionList/index.vue'),
        },
        {
            path: '/roleList',
            name: '_roleList',
            component: () => import('../page/roleList/index.vue'),
        },
        {
            path: '/userManage',
            name: '_userManage',
            component: () => import('../page/userManage/index.vue'),
        },
        {
            path: '/upload',
            name: '_upload',
            component: () => import('../page/userManage/upload.vue'),
        },
    ]
},
{
    path: '/login',
    name: '_login',
    component: () => import('../page/login/index.vue'),
},

{
    path: '/:pathMatch(.*)*',
    name: 'NotFound',
    component: () => import('../page/404/index.vue')
}]
const router = createRouter({
    // 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。
    history: createWebHashHistory(),
    routes // `routes: routes` 的缩写
})
export default router
